package com.example.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.pojo.workProjectPojo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * ClassName:workProjectMapp
 * Description:
 *
 * @Author 赵永峰
 * @Create 2024/6/19 18:44
 * @Version 1.0
 */
@Mapper
public interface workProjectMapp {
    //向数据库中插入一行空数据
    @DS("baodingRussia")
    @Insert("insert into work_project (project, projectPlan, progress, " +
            "requestTime, planTime, endTime, " +
            "projectPerson, department, projectPersonTow, " +
            "score, proposePerson,proposePersonTow, effect, " +
            "type1, result, messageUse, " +
            "establishTime, UpdateTime) " +
            "values (#{project},#{projectPlan},#{progress}," +
            "#{requestTime},#{planTime},#{endTime}," +
            "#{projectPerson},#{department},#{projectPersonTow}," +
            "#{score},#{proposePerson},#{proposePersonTow},#{effect}," +
            "#{type1},#{result},#{messageUse}," +
            "#{establishTime},#{UpdateTime})")
    void insertWorkOne(workProjectPojo workProjectPojo);
    //查询所有的数据
    @DS("baodingRussia")
    @Select("select * from work_project")
    List<workProjectPojo> queryAll();
    //修改某一个字段，传入的是修改字符串的类型
    @DS("baodingRussia")
    @Update("update work_project set ${field}=#{val} where id=${idUse}")
    void saveWorkProjectOneStr(Integer idUse, String field, String val);
    //修改某一个字段，传入的是修改字符串的类型
    @DS("baodingRussia")
    @Update("update work_project set ${field}=#{val} where id=${idUse}")
    void saveWorkProjectOneNmb(Integer idUse, String field, Integer val);
}
